package CommandesAlpha;
import editeur.EditeurAlpha;
import Commande.Commande;
import IHM.IHM_addon_Alpha;
import JSON.JSONException;
import JSON.JSONObject;
import Memento.Memento;


public class play_macro implements Commande {

	private EditeurAlpha edit;
	private IHM_addon_Alpha ihm;

public play_macro(EditeurAlpha ed,IHM_addon_Alpha i){
	edit=ed;
	ihm=i;
}
public void execute( )
{	
	final String name=ihm.getMacroName();
	class memplay implements Memento {

		public String MementoToString() {
			return null;
		}

		public void execute() {
			edit.playMacro(name);
		}

		public void unexecute() {
			edit.unplayMacro(name);		
		}
		public JSONObject JSONize() throws JSONException {
			return null;
		}
		
	}
	ihm.debog("Commandes.play_macro");
	if(name!=null){
		Memento com=new memplay();
		edit.retenir(com);
		com.execute();
	}
	
//	

}
public String toString(){
	return "new_macro";
}

}
